package fanshe;

import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.Properties;

public class Test {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        InputStream is = Test.class.getClassLoader().getResourceAsStream("fanshe/pro.properties");
        properties.load(is);
        String className = properties.getProperty("className");
        String method1 = properties.getProperty("method1");
        String method2 = properties.getProperty("method2");

        Class<?> clazz = Class.forName(className);
        Constructor<?> constructor = clazz.getConstructor();
        Student student = (Student) constructor.newInstance();

        Method method = clazz.getMethod(method1, String.class);
        method.invoke(student, "张三");

        Method method3 = clazz.getMethod(method2);
        System.out.println(method3.invoke(student));
    }
}
